package cn.com.jcoo.security.enums;

/**
 * SM4算法（不同模式枚举）
 *
 * @author Jinty
 * @since 1.0
 */
public enum Sm4Algorithm {
	ECB_NOPADDING(GroupMode.ECB, PaddingMode.NOPADDING), ECB_PKCS5PADDING(GroupMode.ECB,
			PaddingMode.PKCS5PADDING), ECB_ISO10126PADDING(GroupMode.ECB,
					PaddingMode.ISO10126PADDING),

	CBC_NOPADDING(GroupMode.CBC, PaddingMode.NOPADDING), CBC_PKCS5PADDING(GroupMode.CBC,
			PaddingMode.PKCS5PADDING), CBC_ISO10126PADDING(GroupMode.CBC,
					PaddingMode.ISO10126PADDING),

	PCBC_NOPADDING(GroupMode.PCBC, PaddingMode.NOPADDING), PCBC_PKCS5PADDING(
			GroupMode.PCBC, PaddingMode.PKCS5PADDING), PCBC_ISO10126PADDING(
					GroupMode.PCBC, PaddingMode.PKCS5PADDING),

	CTR_PKCS5PADDING(GroupMode.CTR, PaddingMode.PKCS5PADDING), CTR_ISO10126PADDING(
			GroupMode.CTR, PaddingMode.PKCS5PADDING), CTR_NOPADDING(GroupMode.CTR,
					PaddingMode.NOPADDING),

	CTS_NOPADDING(GroupMode.CTS, PaddingMode.NOPADDING), CTS_PKCS5PADDING(GroupMode.CTS,
			PaddingMode.PKCS5PADDING), CTS_ISO10126PADDING(GroupMode.CTS,
					PaddingMode.PKCS5PADDING),;

	private final GroupMode groupMode;

	private final PaddingMode fillMode;

	Sm4Algorithm(GroupMode groupMode, PaddingMode fillMode) {
		this.groupMode = groupMode;
		this.fillMode = fillMode;
	}

	public GroupMode getGroupMode() {
		return groupMode;
	}

	public PaddingMode getFillMode() {
		return fillMode;
	}

	public static String nameOf(Sm4Algorithm algorithm) {
		return "/SM4/" + algorithm.groupMode.name() + "/" + algorithm.getFillMode();
	}
}
